from starlette.applications import Starlette
import core.enterprise_authorize
import core.enterprise_agent
import request_method as methods
from wxenterprise import DepWorkloadRep, EmpWorkloadRep, RepeatProRep, PowerSupplyBureauList, PowerSupplyStationList, \
    ProblemTypeList, ResolventList, EquipmentVenderList, PhotoIndex
# ,PendingProRep,EquipVenderProRep,PendingProSupSta,PendingProSupType,PendingProDet\
# ,BureauWeeklyRepSum,BureauMonRepSum,BureauWeeklyRepSumCheck,BureauMonRepSumCheck,StationWeeklyRep,StationMonRep,WorkRecordCheck\
from wxenterprise import CompanyOperator, PowerSupplyBureauOperator, BureauWeeklyRep, BureauMonRep, StationMonRep, \
    StationWeeklyRep, WorkRecordInsert, WorkRecordCheck, DepartmentVsBureau
from wxenterprise import PendingProRep, EquipVenderProRep, PendingProSupSta, PendingProSupType, PendingProDet, \
    BureauWeeklyRepSum, BureauWeeklyRepSumCheck, BureauMonRepSum, BureauMonRepSumCheck, AreaList, \
    SelectDetatilByMeterbarcode, EquipmentClassifyList, WorkrecordConfirm, WorkrecordProOther, SuperviseRecordSelect, \
    SuperviseConfirmOperator
from wxenterprise import factory_mode

control = Starlette()
# 项目部工作量统计
control.add_route("/ent/dwr", DepWorkloadRep.DepWorkloadRep, methods=methods.get)
control.add_route("/ent/dwr/detail", DepWorkloadRep.DepWorkloadRepDetail, methods=methods.get)
# 人员工作量统计
control.add_route("/ent/ewr", EmpWorkloadRep.EmpWorkloadRep, methods=methods.get)
control.add_route("/ent/ewr/detail", EmpWorkloadRep.EmpWorkloadRepDetail, methods=methods.get)
# 重复处理问题统计表
control.add_route("/ent/rpp", RepeatProRep.RepeatProRep, methods=methods.get)
control.add_route("/ent/rpp/detail", RepeatProRep.RepeatProRepDetail, methods=methods.get)
# 待处理问题统计表
control.add_route("/ent/ppr", PendingProRep.PendingProRep, methods=methods.get)
control.add_route("/ent/ppr/detail", PendingProRep.PendingProRepDetail, methods=methods.get)
# #厂家问题分类统计表
control.add_route("/ent/evpr", EquipVenderProRep.EquipVenderProRep, methods=methods.get)
control.add_route("/ent/evpr/pro", EquipVenderProRep.EquipVenderProRepDetail, methods=methods.get)
# 待处理问题汇总表（按供电所）局长、班长、主任、供电所长
control.add_route("/ent/ppss", PendingProSupSta.PendingProSupSta, methods=methods.get)
control.add_route("/ent/ppss/all", PendingProSupSta.PendingProSupStaAll, methods=methods.put)
control.add_route("/ent/ppss/single", PendingProSupSta.PendingProSupStaSingle, methods=methods.put)
# #待处理问题汇总表（按故障分类）
control.add_route("/ent/ppst", PendingProSupType.PendingProSupType, methods=methods.get)
control.add_route("/ent/ppst/detail", PendingProSupType.PendingProSupTypeDetail, methods=methods.get)
# #待处理问题明细表（督办）
control.add_route("/ent/ppd", PendingProDet.PendingProDet, methods=methods.get)
# 工作总结周报填报
control.add_route("/ent/bwrs", BureauWeeklyRepSum.BureauWeeklyRepSum, methods=methods.get)
control.add_route("/ent/bwrs", BureauWeeklyRepSum.BureauWeeklyRepSum, methods=methods.put)
# 工作总结周报增加列表
control.add_route("/ent/bwrs/list", BureauWeeklyRepSum.BureauWeeklyRepSumList, methods=methods.get)
# 工作总结月报填报
control.add_route("/ent/bwms", BureauMonRepSum.BureauMonRepSum, methods=methods.get)
control.add_route("/ent/bwms", BureauMonRepSum.BureauMonRepSum, methods=methods.put)
# 工作总结月报增加列表
control.add_route("/ent/bwms/list", BureauMonRepSum.BureauMonRepSumList, methods=methods.get)

# 工作总结周报审核
control.add_route("/ent/bwrs/check", BureauWeeklyRepSumCheck.BureauWeeklyRepSumCheck, methods=methods.get)
control.add_route("/ent/bwrs/check", BureauWeeklyRepSumCheck.BureauWeeklyRepSumCheck, methods=methods.put)
control.add_route("/ent/bwrs/check/count", BureauWeeklyRepSumCheck.BureauWeeklyRepSumCheckCount, methods=methods.get)
# 工作总结月报审核
control.add_route("/ent/bwms/check", BureauMonRepSumCheck.BureauMonRepSumCheck, methods=methods.get)
control.add_route("/ent/bwms/check", BureauMonRepSumCheck.BureauMonRepSumCheck, methods=methods.put)
control.add_route("/ent/bwms/check/count", BureauMonRepSumCheck.BureauMonRepSumCheckCount, methods=methods.get)
# 供电所指标排名周报
control.add_route("/ent/swr", StationWeeklyRep.StationWeeklyRep, methods=methods.get)
# 供电所指标排名月报
control.add_route("/ent/smr", StationMonRep.StationMonRep, methods=methods.get)
# 供电局指标排名周报
control.add_route("/ent/bwr", BureauWeeklyRep.BureauWeeklyRep, methods=methods.get)
# 供电局指标排名月报
control.add_route("/ent/bmr", BureauMonRep.BureauMonRep, methods=methods.get)
# #项目经理现场工作确认
control.add_route("/ent/wrc", WorkRecordCheck.WorkRecordCheck, methods=methods.get)
control.add_route("/ent/wrc", WorkRecordCheck.WorkRecordCheck, methods=methods.put)
control.add_route("/ent/wrcc", WorkRecordCheck.WorkRecordCheckCount, methods=methods.get)
# 现场工作登记
control.add_route("/ent/wri", WorkRecordInsert.WorkRecordInsert, methods=methods.post)

# 县局对照表
control.add_route("/ent/psbl", PowerSupplyBureauList.PowerSupplyBureauList, methods=methods.get)
control.add_route("/ent/psbl/all", PowerSupplyBureauList.PowerSupplyBureauListAll, methods=methods.get)
# 供电所对照表
control.add_route("/ent/pssl/all", PowerSupplyStationList.PowerSupplyStationListAll, methods=methods.get)
control.add_route("/ent/pssl/single", PowerSupplyStationList.PowerSupplyStationListSingle, methods=methods.get)
# 问题对照表
control.add_route("/ent/ptl", ProblemTypeList.ProblemTypeList, methods=methods.get)
control.add_route("/ent/ptl", ProblemTypeList.ProblemTypeList, methods=methods.post)
# 解决方法对照表
control.add_route("/ent/rl", ResolventList.ResolventList, methods=methods.get)
control.add_route("/ent/rl", ResolventList.ResolventList, methods=methods.post)
# 设备厂家对照表
control.add_route("/ent/evl", EquipmentVenderList.EquipmentVenderList, methods=methods.get)
# 图片索引表
control.add_route("/ent/pi", PhotoIndex.PhotoIndex, methods=methods.get)
# 图片预览
control.add_route("/ent/photo/preview/{fingerprint}", PhotoIndex.PhotoPreview, methods=methods.get)
# 公司操作员对照表
control.add_route("/ent/co", CompanyOperator.CompanyOperatorControl, methods=methods.common)
control.add_route("/ent/co/{openid:str}", CompanyOperator.SetupCompanyOperator, methods=methods.get + methods.put)
# 县局操作员对照表
control.add_route("/ent/psbo", PowerSupplyBureauOperator.PowerSupplyBureauOperator, methods=methods.get)
control.add_route("/ent/psbos", PowerSupplyBureauOperator.AllPowerSupplyBureauOperator, methods=methods.get)
control.add_route("/ent/psbo/{openid:str}",
                  PowerSupplyBureauOperator.LinkPowerSupplyBureauOperator, methods=methods.get + methods.put)
# 项目部县局对照表
control.add_route("/ent/dvb", DepartmentVsBureau.DepartmentVsBureauControl, methods=methods.common)
control.add_route("/ent/dvb", DepartmentVsBureau.DepartmentVsBureauControl, methods=methods.put)
# 区域对照表
control.add_route("/ent/al", AreaList.AreaList, methods=methods.get)

# 按条码查询记录明细
control.add_route("/ent/sdbm", SelectDetatilByMeterbarcode.SelectDetatilByMeterbarcode, methods=methods.get)

# 设备类型对照表
control.add_route("/ent/ecf", EquipmentClassifyList.EquipmentClassifyList, methods=methods.get)

# 项目部确认统计表
control.add_route("/ent/wc", WorkrecordConfirm.WorkrecordConfirm, methods=methods.get)

# 其他类问题统计表
control.add_route("/ent/wpo", WorkrecordProOther.WorkrecordProOther, methods=methods.get)
control.add_route("/ent/wpo/detail", WorkrecordProOther.WorkrecordProOtherDetail, methods=methods.get)

# 督办记录查询
control.add_route("/ent/srs", SuperviseRecordSelect.SuperviseRecordSelect, methods=methods.get)
control.add_route("/ent/srs/detail", SuperviseRecordSelect.SuperviseRecordDetail, methods=methods.get)
control.add_route("/ent/srs/assist", SuperviseRecordSelect.OperatorAssistRecord, methods=methods.get)
# 运维督办核实页面
control.add_route("/ent/sco", SuperviseConfirmOperator.SuperviseConfirmOperator, methods=methods.get)
control.add_route("/ent/scd", SuperviseConfirmOperator.SuperviseConfirmDetail, methods=methods.put)
control.add_route("/ent/scd", SuperviseConfirmOperator.SuperviseConfirmDetail, methods=methods.get)
control.add_route("/ent/scc", SuperviseConfirmOperator.SuperviseConfirmCount, methods=methods.get)
# 工程模式
control.add_route("/ent/factory/send/random/message", factory_mode.SendRandomMessage, methods=methods.post)
